package com.vone.ui;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JScrollPane;

public class MyScrollPane extends JScrollPane{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public MyScrollPane(){
		super();
		init();
	}
	public MyScrollPane(Component c){
		super(c);
		init();
	}
	public MyScrollPane(int arg1,int arg2){
		super(arg1,arg2);
		init();
	}
	
	public MyScrollPane(Component c,int arg1,int arg2){
		super(c,arg1,arg2);
		init();
	}
	
	
    private void init() {
        getVerticalScrollBar().setUI(new MyVerticalScrollBarUI());
        getHorizontalScrollBar().setUI(new MyHorizontalScrollBarUI());
        //设置鼠标滚轮滚动速度
        getVerticalScrollBar().setUnitIncrement(10);
    }
    
    public void setScorllBarBackColor(Color backColor){
    	MyVerticalScrollBarUI vsbUI=(MyVerticalScrollBarUI) getVerticalScrollBar().getUI();
    	MyHorizontalScrollBarUI hsbUI=(MyHorizontalScrollBarUI) getHorizontalScrollBar().getUI();
    	vsbUI.setBackColor(backColor);
    	hsbUI.setBackColor(backColor);
    }
}
